<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>bom浏览器对象模型</title>
</head>
<style>
  div {
    width: 200px;
    height: 222px;
    background-color: antiquewhite;
  }
</style>

<body>
  <div></div>
</body>
<script>
  // load 窗口界面加载事件
  window.addEventListener('load', function () {
    var div = document.querySelector('div')
    window.addEventListener('resize', function () {
      console.log(window)
      console.log(window.innerWidth)
      console.log(div.style.dispaly)
      if (window.innerWidth < 800) {
        div.style.dispaly = "none"
      } else {
        div.style.dispaly = "block"
      }
    })
  })
  // 定时器
  setTimeout(()=>{
    alert('定时器启动')
  },4000)

  // 每隔一段时间就去调用
  // setInterval(()=>{
  //   console.log('wudi')
  // },2000)
</script>

</html>